package com.bungarus.device.codec.protobuf;

import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;

/**
 * <pre>
 * The greeting service definition.
 * </pre>
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.10.0)",
    comments = "Source: Device.proto")
public final class DeviceServiceGrpc {

  private DeviceServiceGrpc() {}

  public static final String SERVICE_NAME = "bungarus.device.DeviceService";

  // Static method descriptors that strictly reflect the proto.
  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  @java.lang.Deprecated // Use {@link #getRegisterDeviceMethod()} instead. 
  public static final io.grpc.MethodDescriptor<com.bungarus.device.codec.protobuf.DeviceProtobuf.RegisterDeviceRequest,
      com.bungarus.device.codec.protobuf.DeviceProtobuf.OpResultReply> METHOD_REGISTER_DEVICE = getRegisterDeviceMethodHelper();

  private static volatile io.grpc.MethodDescriptor<com.bungarus.device.codec.protobuf.DeviceProtobuf.RegisterDeviceRequest,
      com.bungarus.device.codec.protobuf.DeviceProtobuf.OpResultReply> getRegisterDeviceMethod;

  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  public static io.grpc.MethodDescriptor<com.bungarus.device.codec.protobuf.DeviceProtobuf.RegisterDeviceRequest,
      com.bungarus.device.codec.protobuf.DeviceProtobuf.OpResultReply> getRegisterDeviceMethod() {
    return getRegisterDeviceMethodHelper();
  }

  private static io.grpc.MethodDescriptor<com.bungarus.device.codec.protobuf.DeviceProtobuf.RegisterDeviceRequest,
      com.bungarus.device.codec.protobuf.DeviceProtobuf.OpResultReply> getRegisterDeviceMethodHelper() {
    io.grpc.MethodDescriptor<com.bungarus.device.codec.protobuf.DeviceProtobuf.RegisterDeviceRequest, com.bungarus.device.codec.protobuf.DeviceProtobuf.OpResultReply> getRegisterDeviceMethod;
    if ((getRegisterDeviceMethod = DeviceServiceGrpc.getRegisterDeviceMethod) == null) {
      synchronized (DeviceServiceGrpc.class) {
        if ((getRegisterDeviceMethod = DeviceServiceGrpc.getRegisterDeviceMethod) == null) {
          DeviceServiceGrpc.getRegisterDeviceMethod = getRegisterDeviceMethod = 
              io.grpc.MethodDescriptor.<com.bungarus.device.codec.protobuf.DeviceProtobuf.RegisterDeviceRequest, com.bungarus.device.codec.protobuf.DeviceProtobuf.OpResultReply>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
              .setFullMethodName(generateFullMethodName(
                  "bungarus.device.DeviceService", "registerDevice"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.bungarus.device.codec.protobuf.DeviceProtobuf.RegisterDeviceRequest.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.bungarus.device.codec.protobuf.DeviceProtobuf.OpResultReply.getDefaultInstance()))
                  .setSchemaDescriptor(new DeviceServiceMethodDescriptorSupplier("registerDevice"))
                  .build();
          }
        }
     }
     return getRegisterDeviceMethod;
  }
  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  @java.lang.Deprecated // Use {@link #getGetDeviceListMethod()} instead. 
  public static final io.grpc.MethodDescriptor<com.bungarus.device.codec.protobuf.DeviceProtobuf.DeviceListRequest,
      com.bungarus.device.codec.protobuf.DeviceProtobuf.DeviceListReply> METHOD_GET_DEVICE_LIST = getGetDeviceListMethodHelper();

  private static volatile io.grpc.MethodDescriptor<com.bungarus.device.codec.protobuf.DeviceProtobuf.DeviceListRequest,
      com.bungarus.device.codec.protobuf.DeviceProtobuf.DeviceListReply> getGetDeviceListMethod;

  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  public static io.grpc.MethodDescriptor<com.bungarus.device.codec.protobuf.DeviceProtobuf.DeviceListRequest,
      com.bungarus.device.codec.protobuf.DeviceProtobuf.DeviceListReply> getGetDeviceListMethod() {
    return getGetDeviceListMethodHelper();
  }

  private static io.grpc.MethodDescriptor<com.bungarus.device.codec.protobuf.DeviceProtobuf.DeviceListRequest,
      com.bungarus.device.codec.protobuf.DeviceProtobuf.DeviceListReply> getGetDeviceListMethodHelper() {
    io.grpc.MethodDescriptor<com.bungarus.device.codec.protobuf.DeviceProtobuf.DeviceListRequest, com.bungarus.device.codec.protobuf.DeviceProtobuf.DeviceListReply> getGetDeviceListMethod;
    if ((getGetDeviceListMethod = DeviceServiceGrpc.getGetDeviceListMethod) == null) {
      synchronized (DeviceServiceGrpc.class) {
        if ((getGetDeviceListMethod = DeviceServiceGrpc.getGetDeviceListMethod) == null) {
          DeviceServiceGrpc.getGetDeviceListMethod = getGetDeviceListMethod = 
              io.grpc.MethodDescriptor.<com.bungarus.device.codec.protobuf.DeviceProtobuf.DeviceListRequest, com.bungarus.device.codec.protobuf.DeviceProtobuf.DeviceListReply>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
              .setFullMethodName(generateFullMethodName(
                  "bungarus.device.DeviceService", "getDeviceList"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.bungarus.device.codec.protobuf.DeviceProtobuf.DeviceListRequest.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.bungarus.device.codec.protobuf.DeviceProtobuf.DeviceListReply.getDefaultInstance()))
                  .setSchemaDescriptor(new DeviceServiceMethodDescriptorSupplier("getDeviceList"))
                  .build();
          }
        }
     }
     return getGetDeviceListMethod;
  }

  /**
   * Creates a new async stub that supports all call types for the service
   */
  public static DeviceServiceStub newStub(io.grpc.Channel channel) {
    return new DeviceServiceStub(channel);
  }

  /**
   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
   */
  public static DeviceServiceBlockingStub newBlockingStub(
      io.grpc.Channel channel) {
    return new DeviceServiceBlockingStub(channel);
  }

  /**
   * Creates a new ListenableFuture-style stub that supports unary calls on the service
   */
  public static DeviceServiceFutureStub newFutureStub(
      io.grpc.Channel channel) {
    return new DeviceServiceFutureStub(channel);
  }

  /**
   * <pre>
   * The greeting service definition.
   * </pre>
   */
  public static abstract class DeviceServiceImplBase implements io.grpc.BindableService {

    /**
     * <pre>
     * Sends a greeting
     * </pre>
     */
    public void registerDevice(com.bungarus.device.codec.protobuf.DeviceProtobuf.RegisterDeviceRequest request,
        io.grpc.stub.StreamObserver<com.bungarus.device.codec.protobuf.DeviceProtobuf.OpResultReply> responseObserver) {
      asyncUnimplementedUnaryCall(getRegisterDeviceMethodHelper(), responseObserver);
    }

    /**
     */
    public void getDeviceList(com.bungarus.device.codec.protobuf.DeviceProtobuf.DeviceListRequest request,
        io.grpc.stub.StreamObserver<com.bungarus.device.codec.protobuf.DeviceProtobuf.DeviceListReply> responseObserver) {
      asyncUnimplementedUnaryCall(getGetDeviceListMethodHelper(), responseObserver);
    }

    @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
          .addMethod(
            getRegisterDeviceMethodHelper(),
            asyncUnaryCall(
              new MethodHandlers<
                com.bungarus.device.codec.protobuf.DeviceProtobuf.RegisterDeviceRequest,
                com.bungarus.device.codec.protobuf.DeviceProtobuf.OpResultReply>(
                  this, METHODID_REGISTER_DEVICE)))
          .addMethod(
            getGetDeviceListMethodHelper(),
            asyncUnaryCall(
              new MethodHandlers<
                com.bungarus.device.codec.protobuf.DeviceProtobuf.DeviceListRequest,
                com.bungarus.device.codec.protobuf.DeviceProtobuf.DeviceListReply>(
                  this, METHODID_GET_DEVICE_LIST)))
          .build();
    }
  }

  /**
   * <pre>
   * The greeting service definition.
   * </pre>
   */
  public static final class DeviceServiceStub extends io.grpc.stub.AbstractStub<DeviceServiceStub> {
    private DeviceServiceStub(io.grpc.Channel channel) {
      super(channel);
    }

    private DeviceServiceStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected DeviceServiceStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new DeviceServiceStub(channel, callOptions);
    }

    /**
     * <pre>
     * Sends a greeting
     * </pre>
     */
    public void registerDevice(com.bungarus.device.codec.protobuf.DeviceProtobuf.RegisterDeviceRequest request,
        io.grpc.stub.StreamObserver<com.bungarus.device.codec.protobuf.DeviceProtobuf.OpResultReply> responseObserver) {
      asyncUnaryCall(
          getChannel().newCall(getRegisterDeviceMethodHelper(), getCallOptions()), request, responseObserver);
    }

    /**
     */
    public void getDeviceList(com.bungarus.device.codec.protobuf.DeviceProtobuf.DeviceListRequest request,
        io.grpc.stub.StreamObserver<com.bungarus.device.codec.protobuf.DeviceProtobuf.DeviceListReply> responseObserver) {
      asyncUnaryCall(
          getChannel().newCall(getGetDeviceListMethodHelper(), getCallOptions()), request, responseObserver);
    }
  }

  /**
   * <pre>
   * The greeting service definition.
   * </pre>
   */
  public static final class DeviceServiceBlockingStub extends io.grpc.stub.AbstractStub<DeviceServiceBlockingStub> {
    private DeviceServiceBlockingStub(io.grpc.Channel channel) {
      super(channel);
    }

    private DeviceServiceBlockingStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected DeviceServiceBlockingStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new DeviceServiceBlockingStub(channel, callOptions);
    }

    /**
     * <pre>
     * Sends a greeting
     * </pre>
     */
    public com.bungarus.device.codec.protobuf.DeviceProtobuf.OpResultReply registerDevice(com.bungarus.device.codec.protobuf.DeviceProtobuf.RegisterDeviceRequest request) {
      return blockingUnaryCall(
          getChannel(), getRegisterDeviceMethodHelper(), getCallOptions(), request);
    }

    /**
     */
    public com.bungarus.device.codec.protobuf.DeviceProtobuf.DeviceListReply getDeviceList(com.bungarus.device.codec.protobuf.DeviceProtobuf.DeviceListRequest request) {
      return blockingUnaryCall(
          getChannel(), getGetDeviceListMethodHelper(), getCallOptions(), request);
    }
  }

  /**
   * <pre>
   * The greeting service definition.
   * </pre>
   */
  public static final class DeviceServiceFutureStub extends io.grpc.stub.AbstractStub<DeviceServiceFutureStub> {
    private DeviceServiceFutureStub(io.grpc.Channel channel) {
      super(channel);
    }

    private DeviceServiceFutureStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected DeviceServiceFutureStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new DeviceServiceFutureStub(channel, callOptions);
    }

    /**
     * <pre>
     * Sends a greeting
     * </pre>
     */
    public com.google.common.util.concurrent.ListenableFuture<com.bungarus.device.codec.protobuf.DeviceProtobuf.OpResultReply> registerDevice(
        com.bungarus.device.codec.protobuf.DeviceProtobuf.RegisterDeviceRequest request) {
      return futureUnaryCall(
          getChannel().newCall(getRegisterDeviceMethodHelper(), getCallOptions()), request);
    }

    /**
     */
    public com.google.common.util.concurrent.ListenableFuture<com.bungarus.device.codec.protobuf.DeviceProtobuf.DeviceListReply> getDeviceList(
        com.bungarus.device.codec.protobuf.DeviceProtobuf.DeviceListRequest request) {
      return futureUnaryCall(
          getChannel().newCall(getGetDeviceListMethodHelper(), getCallOptions()), request);
    }
  }

  private static final int METHODID_REGISTER_DEVICE = 0;
  private static final int METHODID_GET_DEVICE_LIST = 1;

  private static final class MethodHandlers<Req, Resp> implements
      io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
    private final DeviceServiceImplBase serviceImpl;
    private final int methodId;

    MethodHandlers(DeviceServiceImplBase serviceImpl, int methodId) {
      this.serviceImpl = serviceImpl;
      this.methodId = methodId;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        case METHODID_REGISTER_DEVICE:
          serviceImpl.registerDevice((com.bungarus.device.codec.protobuf.DeviceProtobuf.RegisterDeviceRequest) request,
              (io.grpc.stub.StreamObserver<com.bungarus.device.codec.protobuf.DeviceProtobuf.OpResultReply>) responseObserver);
          break;
        case METHODID_GET_DEVICE_LIST:
          serviceImpl.getDeviceList((com.bungarus.device.codec.protobuf.DeviceProtobuf.DeviceListRequest) request,
              (io.grpc.stub.StreamObserver<com.bungarus.device.codec.protobuf.DeviceProtobuf.DeviceListReply>) responseObserver);
          break;
        default:
          throw new AssertionError();
      }
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public io.grpc.stub.StreamObserver<Req> invoke(
        io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        default:
          throw new AssertionError();
      }
    }
  }

  private static abstract class DeviceServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
    DeviceServiceBaseDescriptorSupplier() {}

    @java.lang.Override
    public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
      return com.bungarus.device.codec.protobuf.DeviceProtobuf.getDescriptor();
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
      return getFileDescriptor().findServiceByName("DeviceService");
    }
  }

  private static final class DeviceServiceFileDescriptorSupplier
      extends DeviceServiceBaseDescriptorSupplier {
    DeviceServiceFileDescriptorSupplier() {}
  }

  private static final class DeviceServiceMethodDescriptorSupplier
      extends DeviceServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final String methodName;

    DeviceServiceMethodDescriptorSupplier(String methodName) {
      this.methodName = methodName;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
      return getServiceDescriptor().findMethodByName(methodName);
    }
  }

  private static volatile io.grpc.ServiceDescriptor serviceDescriptor;

  public static io.grpc.ServiceDescriptor getServiceDescriptor() {
    io.grpc.ServiceDescriptor result = serviceDescriptor;
    if (result == null) {
      synchronized (DeviceServiceGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new DeviceServiceFileDescriptorSupplier())
              .addMethod(getRegisterDeviceMethodHelper())
              .addMethod(getGetDeviceListMethodHelper())
              .build();
        }
      }
    }
    return result;
  }
}
